<template>
  <header class="main-header">
    <div style="text-align: right;margin: 10px">
      <span>欢迎</span>
      <span>{{loginName}}</span>
      <span style="color: green ;" @click="loginOut">退出登录</span>
    </div>

    <h1>Todo</h1>
  </header>
</template>

<style scoped lang="stylus">
  .main-header {
    text-align center
    h1 {
      font-size 70px
      color rgba(52, 255, 0, 0.4)
      font-weight 300
      margin 20px
      color: #f00
    }
  }
</style>

<script>
  export default {
    props: {
      loginName: {
        type: String,
        required: true
      }
    },
    data() {
      return {}
    },
    methods: {
      loginOut() {
        localStorage.removeItem("userInfo")
        this.$router.push('/login')
      }
    }
  }
</script>
